Process Response
The response returned from the Payment Gateway would be in a field called data. This would be encrypted using the same set of AES - IV & Secret Keys and hence would need to be decrypted using HesabeCrypt library’s decrypt function. The value after decryption would be like on the right.
Sample Response
{
"status": true,
"code": 1,
"message": "Transaction Success",
"response": {
"data": {
"resultCode": "CAPTURED",
"amount": 10,
"paymentToken": "1569830677725743478",
"paymentId": "100201927384634224",
"paidOn": "2019-09-30 11:05:16",
"orderReferenceNumber": null,
"variable1": null,
"variable2": null,
"variable3": null,
"variable4": null,
"variable5": null,
"method": 1,
"administrativeCharge": "5"
}
}
}
Response Parameters
Field | Type | Description |
---|---|---|
status | Boolean | Payment status (true for success; false for failure) |
resultCode | String | Success transactions have values "CAPTURED", "ACCEPT", or "SUCCESS" |
amount | Numeric | Amount must be greater than zero |
paymentToken | Numeric | 14-digit Payment Token returned from Hesabe |
paymentId | Alphanumeric | Payment Id returned from Hesabe |
paidOn | Alphanumeric | Date and Time of Payment |
orderReferenceNumber | Alphanumeric | Custom user parameter passed in the request |
variable1 | Alphanumeric | Custom user parameter included in the response |
variable2 | Alphanumeric | Custom user parameter included in the response |
variable3 | Alphanumeric | Custom user parameter included in the response |
variable4 | Alphanumeric | Custom user parameter included in the response |
variable5 | Alphanumeric | Custom user parameter included in the response |
method | Numeric | 1 or 2 (1 for KNET; 2 for MPGS) |
administrativeCharge | Numeric | Administrative Charge |
Error Codes
Code | Description |
---|---|
0 | Invalid Response |
422 | Invalid Input |
500 | Invalid Token |
501 | Invalid Merchant |
503 | Invalid Merchant Service |
504 | Invalid Merchant Login Credentials |
505 | Invalid Payment Token |
506 | Invalid Request Data |
507 | Transaction Error |
Based on the status (success or failure), appropriate messages can be shown by the client on the confirmation page.